package com.hpdf.utils.web.resultbean;

import java.io.Serializable;

import com.hpdf.constants.ErrorType;

/**
 * 统一返回结果集
 * 
 * Copyright: Copyright (c) 2017 zteits
 * 
 * @ClassName: BizResult.java
 * @Description:
 * @version: v1.0.0
 * @author: liuzl
 * @date: 2017年4月24日 下午6:17:24 Modification History: Date Author Version
 *        Description ---------------------------------------------------------*
 *        2017年4月24日 liuzl v1.0.0 创建
 */
public class BizResult<T> implements Serializable {

	private static final long serialVersionUID = 1L;

	/** . */
	private boolean success;

	/** . */
	private String errCode;

	/** . */
	private String errMsg;

	/** . */
	private T data;

	public BizResult() {
		super();
	}

	public BizResult(String errCode, String errMsg) {
		this.errCode = errCode;
		this.errMsg = errMsg;
		this.success = false;
	}

	public BizResult(T data) {
		this.data = data;
		this.success = true;
		this.errCode = ErrorType.BIZ_SUCCESS.getCode();
		this.errMsg = ErrorType.BIZ_SUCCESS.getMsg();

	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getErrMsg() {
		return errMsg;
	}

	public void setErrMsg(String errMsg) {
		this.errMsg = errMsg;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public String getErrCode() {
		return errCode;
	}

	public void setErrCode(String errCode) {
		this.errCode = errCode;
	}

	@Override
	public String toString() {
		return "BizResult [success=" + success + ", errMsg=" + errMsg + ", data=" + data + ", errCode=" + errCode + "]";
	}

}
